package cn.zyl.quartz.Job;

import org.quartz.*;

@PersistJobDataAfterExecution //告诉Quartz在任务执行成功完毕之后（没有抛出异常），修改JobDetail的JobDataMap备份，以供下一个任务使用
@DisallowConcurrentExecution
public class Job1 implements Job{

    private String name;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        //通过context获取DataMap中传递的参数
        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        String name = (String)jobDataMap.getString("name");

        System.out.println("Hello "+ name );
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
